<h2 class="dialog_title"><span>Daftar Perbuatan</span></h2>
<div class="dialog_content" style="padding: 10px 20px; width:700px">
<?php $res = mysql_fetch_assoc(kary_load($kary_id))?>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
	<tr>
	  <td align="right">Karyawan : </td>
	  <td><strong><?php echo $res['NAMA_KARYAWAN'] ?></strong></td>
    </tr>
	<tr>
		<td width="100" align="right" >Periode : </td>
		<td><strong><?php echo $month ?> - <?php echo $year ?></strong></td>
	</tr>
</table>
<table style="border:1px solid #457A3F;" width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr class="header">
  	<th align="left"><span class="colorWhite">Tgl Lapor</span></th>
    <th align="left"><span class="colorWhite">Jenis</span></th>
    <th align="left"><span class="colorWhite">Bidang</span></th>
    <th align="left"><span class="colorWhite">Tingkat</span></th>
    <th align="left"><span class="colorWhite">Kategori</span></th>
    <th align="right"><span class="colorWhite">Perbuatan Ke</span></th>
    <th align="right"><span class="colorWhite">Point</span></th>  
  </tr>
  <tbody id="searchKary-table" style="overflow:scroll; height:200px" >
<?php
	$sql = "SELECT a.PERB_TGL, d.ACHIEV_JENIS, d.ACHIEV_BIDANG, e.DETACHIEV_ID, e.DETACHIEV_TINGKAT, 
				e.DETACHIEV_NAMA, b.DEPERB_COUNT, 
				(
					SELECT NILAI_POINT 
					FROM NILAI as xx 
					WHERE b.DEPERB_COUNT BETWEEN xx.NILAI_MIN AND xx.NILAI_MAX 
						AND xx.DETACHIEV_ID = e.DETACHIEV_ID
				) as POINT
		FROM perbuatan as a, detil_perbuatan as b, data_karyawan as c, 
			prestasipelanggaran as d, detil_prestasi_pelanggaran as e
		WHERE a.PERB_NO = b.PERB_NO 
			AND a.KODE_KARYAWAN = c.KODE_KARYAWAN 
			AND b.DETACHIEV_ID = e.DETACHIEV_ID 
			AND d.ACHIEV_ID = e.ACHIEV_ID 
			AND b.DEPERB_STATUS='2' 
			AND month(a.PERB_TGL)='$month' 
			AND year(a.PERB_TGL)='$year' 
			AND a.KODE_KARYAWAN='$kary_id' 
		ORDER BY PERB_TGL, ACHIEV_BIDANG, b.DEPERB_COUNT";
	$result = mysql_query($sql);
	
	$pointCount = 0;
?>
<?php while ($row = mysql_fetch_assoc($result)): $pointCount += $row['POINT']; ?>
  <tr <?php echo tag_zebra($z++)?>>
  	<td><?php echo $row['PERB_TGL']?></td>
  	<td><?php echo $row['ACHIEV_JENIS']?></td>
    <td><?php echo $row['ACHIEV_BIDANG']?></td>
    <td><?php echo $row['DETACHIEV_TINGKAT']?></td>
    <td><?php echo $row['DETACHIEV_NAMA']?></td>
    <td align="right"><?php echo $row['DEPERB_COUNT']?></td>
    <td align="right"><?php echo $row['POINT']?></td>
  </tr>
<?php endwhile;?>
  </tbody>
  <tr class="header">
    <th align="right" colspan="6"><span class="colorWhite">Jumlah Point : </span></th>
    <th align="right"><span class="colorWhite"><?php echo $pointCount ?></span></th>  
  </tr>
</table>
</div>
<div class="dialog_buttons"><input type="button" value="Close" name="close" onclick="FBModal_hide()" /></div>